<?php

namespace App\Models;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class SysComment
 * @package App\Models
 * @version July 29, 2018, 9:14 am UTC
 *
 * @property string title
 * @property string content
 * @property tinyinteger min_score
 * @property tinyinteger max_score
 */
class SysComment extends Model
{
	use SoftDeletes;

	public $table = 'sys_comments';


	public $fillable = [
		'title',
		'content',
		'temp_id',
		'min_score',
		'max_score'
	];


	protected $dates = ['deleted_at'];

	/**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'title' => 'string',
        'content' => 'string'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        'title' => 'required',
        'content' => 'required'
    ];

    public function temps() {
    	return $this->belongsTo(Temp::class, 'temp_id', 'id');
    }
}
